package cn.nawang.ebeim.verification;

public class SmsVerification {
  public String verify(String sendAddress) {
    VerificationMessage msg = new VerificationMessage(sendAddress);
    return verify(msg);
  }

  public String verifyCode(String sendAddress, String code) {
    VerificationMessage msg = new VerificationMessage(sendAddress, code);
    return verifyCode(msg);
  }

  private String verify(VerificationMessage msg) {
    String url = VerificationConfig.getVerifyUrlSms() + "?" + msg.formatVerifyRequest();
    return HttpUtil.doGet(url);
  }

  private String verifyCode(VerificationMessage msg) {
    String url = VerificationConfig.getVerifyCodeUrl() + "?" + msg.formatVerifyCodeRequest();
    return HttpUtil.doGet(url);
  }
  
  public static final void main(String[] args) {
    String sendAddress = "15260695013";
    
    SmsVerification sv = new SmsVerification();
//  发送
    String result = sv.verify(sendAddress);
    System.out.println(result);
    //  验证
//    String code = "939208";
//    String result = sv.verifyCode(sendAddress, code);
//    System.out.println(result);
  }

}
